<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\Workcorpscontact;
use App\Models\Workcorps;
use App\Services\WorkmsgService;
use App\Services\WorkService;
use App\Services\WorkdataService;
use Log,DB,Exception;

class Domaindeadline extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'domain:deadline';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '域名过期收回';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        // 通知已过期的客户
        $deadline = strtotime(date("Y-m-d",strtotime("+3 days")));
        $domains = Usersdomain::domainDeadline($deadline);
        foreach ($domains as $domain) {
            Usersdomain::domainListDisable($domain->id,3);
            Domainlist::domainListBack($domain->domain);
        }
        return "";
    }
}
